﻿namespace Journey.Data.Users
{
    using Journey.Data.EntityFramework;
    using Journey.Domain.Users;
    using Journey.Security;
    using System;

    /// <summary>
    /// 用户数据仓库。
    /// </summary>
    public class UserRepository : EFRepository<User>, IUserRepository
    {
        /// <summary>
        /// 获得用户详细信息。
        /// </summary>
        /// <param name="userId">用户编号。</param>
        /// <returns>用户详细信息。</returns>
        public User GetUser(Guid userId)
        {
            return Get(userId);
        }

        /// <summary>
        /// 获得用户详细信息。
        /// </summary>
        /// <param name="accountNumber">用户怅号。</param>
        /// <returns>用户详细信息。</returns>
        public User GetUser(string accountNumber)
        {
            return Get(user => user.Account.AccountNumber == accountNumber);
        }
    }
}